#!/bin/sh
#Check Parameter  
if [[ ! "$1" ]]; then  
    echo "No Parameter...."  
    exit 1  
fi  

#Check record  Files  
files=`ls -l /opt/pub/record | grep "$1"`  
if [[ "$files" ]]; then  
    echo "Yes,List:"  
    echo "$files"  
    /opt/ffmpeg/bin/ffmpeg -strict experimental -ss 00:00:00 -t 00:00:15 -i /opt/pub/record/"$1"  -y -vcodec copy -acodec copy -pass 2 /opt/pub/cut/15_"$1"
else  
    echo "No"
    uploadfiles=`ls -l /opt/pub/upload | grep "$1"`
    if [[ "$uploadfiles" ]]; then
	/opt/ffmpeg/bin/ffmpeg -strict experimental -ss 00:00:00 -t 00:00:15 -i /opt/pub/upload/"$1" -y -vcodec copy -acodec copy -pass 2 /opt/pub/cut/15_"$1"
    fi 	
fi  
